import { Model } from '@wattjs/network'
import Http from './request'

const PREFIX = process.env.VUE_APP_PREFIX

export const getCaptcha = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/createCaptcha'
})

export const refreshCaptcha = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/refreshCaptcha'
})

export const userLogin = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/login',
  method: 'post'
})

export const userLogout = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/logout'
})

export const getUserInfo = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/getCurrentUserInfo'
})

export const getUserInfoByFeild = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/user/getUserInfo',
  method: 'post'
})

export const getMenuByRoles = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/getMenuByRoles',
  method: 'post'
})

export const updatePwd = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/user/updatePwd',
  method: 'post'
})

export const bindDingTalk = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/user/snsBindDingtalk',
  method: 'post'
})

export const unbindDingtalk = Model(Http, {
  prefix: PREFIX,
  needJudgeResContent: false,
  url: '/user/snsUnbindDingtalk'
})

export const ticketLogin = Model(Http, {
  prefix: PREFIX,
  url: '/dingtalk/ticket'
})

export const getMenuByAppId = Model(Http, {
  prefix: PREFIX,
  url: '/getMenuByAppId'
})
